#ifndef SAVEWORK_H
#define SAVEWORK_H

#include <QThread>
#include <QDateTime>

#include "imageInfo.h"
/**
 * @brief The SaveWork class
 * 当imageDialog位置和尺寸发生变化时，延迟向数据库保持数据
 */
class SaveWork : public QThread
{
public:
    explicit SaveWork(QObject *parent = nullptr);
    void setBeginTime(const QDateTime &newBeginTime);
    bool getIsRunning() const;

    void doSaveWork(const ImageInfo &info);

private:
    const int DELAY_SECOND = 1;

    QDateTime beginTime;
    bool isRunning{false};
    void delayTime();
    ImageInfo info;

    // QThread interface
protected:
    void run();
};

#endif
